Class SimplyPresentable::ActiveRecordDomPresenter
In: vendor/plugins/simply_presentable/lib/simply_presentable/presenter/active_record_dom.rb
Parent: SimplyPresentable::ActiveRecordPresenter

Methods

dom_class   dom_id  

Public Instance methods

Return a dom_class to be associated with the presented object:

  present(Foo.new).dom_class
  => foo
  present(Foo.find(1)).dom_class
  => foo

Options:

:dom_prefix:Prefix the dom class:
  present(Bar.find(1)).dom_class(:dom_prefix => 'foo')
  => foo_bar

[Source]

    # File vendor/plugins/simply_presentable/lib/simply_presentable/presenter/active_record_dom.rb, line 28
28:   def dom_class(options = {})
29:     [ options[:dom_prefix], record_name ].compact.join '_'
30:   end

Return a dom_id to be associated with the presented object:

  present(Foo.new).dom_id
  => new_foo
  present(Foo.find(1)).dom_id
  => foo_id

Options:

:dom_prefix:Prefix the dom id:
  present(Bar.find(1)).dom_id(:dom_prefix => 'foo')
  => foo_bar_1

[Source]

    # File vendor/plugins/simply_presentable/lib/simply_presentable/presenter/active_record_dom.rb, line 14
14:   def dom_id(options = {}) 
15:     [ @presenter_proxy.new_record? ? 'new' : nil, options[:dom_prefix], record_name, @presenter_proxy.new_record? ? nil : @presenter_proxy.id ].compact.join '_'
16:   end

[Validate]